
<?php $className = 'evenement';?>
<script type="text/javascript">

function submitForm(idForm){
	var result = tmt.validator.validateForm(idForm);
	if(result){
		document.forms[idForm].submit();
	}
}

function updateList(){
	var xhrO = getXmlHttpRequest2();
	xhrO.open("POST","<?php print url_for('clients/orphans')?>",false);
	xhrO.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhrO.setRequestHeader('X_REQUESTED_WITH','XMLHttpRequest');
	xhrO.send("class=<?php echo $className?>&ajax=true"); 
	document.getElementById('orphansTable').innerHTML = xhrO.responseText;
	$("a.fancy").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	false,
		'titleShow'		: false
	});
}
</script>
<?php
	$continuer = 0;
	$objectDef = new objectDef('evenement');
	
	$q = $objectDef->getBaseQuery();
	$q->addWhere('a.ownerclass= ? ', get_class($self));
	$q->addWhere('a.owner_id='.$self->id);
	$q->setHydrationMode(Doctrine_Core::HYDRATE_ARRAY);
	$items =	$q->execute();
	
	if(count($items) > 0):
		$iconsSize = sfConfig::get('app_defaultViewer_iconssize', '16');
   		$i18N = sfContext::getInstance()->getI18N();
   		if(is_null($hide))
   			$hide = array();
   		?><div class="showTable">
   		
   		<?php if($addFieldSet):?> 
			<fieldset><legend><?php echo $i18N->__('List of '). $i18N->__($objectDef->labelPlural,null,'forms') ?> </legend>
   		<?php endif;?>
   		<a href="#">
		<img src="/images/icons/<?php echo $iconsSize; ?>/add.png" title="'.$i18N->__('Create New').'" <?php echo $objectDef->label ?>/>
		</a>
   		
   		<div id="list_<?php echo $objectDef->className?>">
			<table class="<?php echo $tableClass?>">
			<?php echo $objectDef->renderListHeader($hide,'table',true, 0, $addOrderLink, $orderFunctionParams)?>
			<tbody class="list_elem">
			<?php 
			if(is_array($items)){
				$keys=array_keys($items);
			}
			$i=0;
			$key=0;
			foreach($items as $item):?>
				<tr>
					<?php if(isset($keys)) $key=$keys[$i];?>
					<td>
					<a class="fancy" href="<?php echo url_for('defaultViewer/show?className=' . $className . '&id='.$item['id']);?>"><img src="/images/icons/<?php echo $iconsSize; ?>/show.png" title="<?php echo __('Show')?>"></a>
					<a class="fancy" href="<?php echo url_for('defaultViewer/edit?className=' . $className . '&id='.$item['id']);?>"><img src="/images/icons/<?php echo $iconsSize; ?>/edit.png" title="<?php echo __('Show')?>"></a>
					<a class="fancy" href="<?php echo url_for('defaultViewer/delete?className=' . $className . '&id='.$item['id']);?>"><img src="/images/icons/<?php echo $iconsSize; ?>/delete.png" title="<?php echo __('Show')?>"></a>

					</td>
				
				<?php echo $objectDef->renderListAttributes($item, $hide, 'table')?>
				<?php $i++; ?>
				</tr>
			<?php endforeach;?>
			<input type="hidden" id="q_list_<?php echo $objectDef->className ?>" value="<?php echo $i?>"/>
			</tbody>
			</table>
		</div>
		<?php if($addFieldSet): ?>
			</fieldset>
		<?php endif;?>
		</div>
<?php endif;?>	
